home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2728 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com(Pete)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: strings from VB?
  5. Date: 19 Jan 1996 08:30:03 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4dnkqb$ngn@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: pipe4.h1.usa.pipeline.com
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Jan 18, 1996 16:50:52 in article <strings from VB?>, 'Gooding
  15. <mgooding@wolfenet.com>' wrote: 
  16.  
  17.  
  18. >How does Visual Basic pass strings to functions in a DLL? 
  19.  
  20. By reference (address). 
  21.  
  22. Declare your DLL function in your VB module something like: 
  23.  
  24. Declare Function MyFunc Lib "MYDLL.DLL" (ByVal s as String) as integer 
  25.  
  26. (Note the ByVal) 
  27.  
  28. Sub Foo () 
  29.   Dim Bar as String 
  30.   dim lgth as Integer 
  31.   Bar = "Now is the time for all good ..." 
  32.   lgth = MyFunc(Bar) 
  33.  
  34. If the DLL to writes to a buffer, do something like: 
  35.  
  36. Sub Bleep () 
  37.   Dim Grumpy as String * 75 
  38.   lgth = MyOtherFunc (Grumpy, 75) 
  39.  
  40. Have the DLL return the length of the string and within your 
  41. VB code, adjust the string's length to the returned value. 
  42.  
  43.  
  44.  
  45. -- 
  46. Pete Grant 
  47. Kalevi, Inc. 
  48. Object Oriented Software Development
  49.